package com.tgu.home_action.dao;

import com.tgu.home_action.pojo.Admin;
import com.tgu.home_action.pojo.Dynamic;
import com.tgu.home_action.pojo.Face;
import com.tgu.home_action.pojo.Place;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface FaceMapper {
    /**
     * 插入人脸识别记录
     */
    @Insert("insert into faces (img_url,old_man_id,time,result,volunteer_id,state) values (#{imgUrl},#{oldManId},#{time},#{result},#{volunteerId},#{state})")
    void insertFace(Face face);

    /**
     * 查询人脸识别记录
     */
    @Select("select * from faces where old_man_id=#{oldManId} order by time desc")
    List<Face> getFaces(Integer oldManId);

    /**
     * 通过ID查询人脸识别记录
     */
    @Select("select * from faces where id=#{faceId}")
    Face getFaceById(Integer faceId);

    /**
     * 修改人脸识别状态
     */
    @Update("update faces set state=#{state} where id=#{faceId}")
    void updateState(Integer faceId, Short state);

    /**
     * 查询符合条件的人脸识别记录数量
     */
    Integer getAccordFaceSum(Face face);

    /**
     * 查询符合条件的人脸识别记录
     */
    List<Face> getAccordFace(Face face);

    /**
     * 通过地点查询人脸识别记录
     */
    List<Face> getFaceByPlace(Place place);
}
